package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.InventoryIn;
import com.weipai.springboot.model.InventoryOut;
import com.weipai.springboot.module.dao.InventoryDetailDao;
import com.weipai.springboot.module.mapper.InventoryInMapper;
import com.weipai.springboot.module.mapper.InventoryOutMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author songmengqiang
 * @create 2018-08-24 11:51
 **/
@Repository
public class InventoryDetailDaoImpl implements InventoryDetailDao {

    @Autowired
    private InventoryInMapper inventoryInMapper;

    @Autowired
    private InventoryOutMapper inventoryOutMapper;

    @Override
    public List<Map<String, Object>> listInDetail(String categoryId, Integer start, Integer size, String search) {
        return inventoryInMapper.listInDetail(categoryId, start, size, search);
    }

    @Override
    public List<Map<String, Object>> listOutDetail(String categoryId, Integer start, Integer size, String search) {
        return inventoryOutMapper.listOutDetail(categoryId, start, size, search);
    }

    @Override
    public int outStorage(InventoryOut inventoryOut) {
        return inventoryOutMapper.insert(inventoryOut);
    }

    @Override
    public int countIn(String categoryId, String search) {
        return inventoryInMapper.countIn(categoryId, search);
    }

    @Override
    public int countOut(String categoryId, String search) {
        return inventoryOutMapper.countOut(categoryId, search);
    }

    @Override
    public int inStorage(InventoryIn inventoryIn) {
        return inventoryInMapper.insertSelective(inventoryIn);
    }
}
